1. Technical Field
The present invention relates generally to an improved data processing system and in particular to a method and apparatus for providing communication between an application and a device. Still more particularly, the present invention provides a method and apparatus for providing communication between an application and a device using a device driver.
2. Description of Related Art
A computer includes both a physical machine, namely the hardware, and the instructions which cause the physical machine to operate, namely the software. Software includes both application and operating system programs. If the program is simply to do tasks for a user, such as solving specific problems, it is referred to as application software. If a program controls the hardware of the computer and the execution of the application programs, it is called operating system software. System software further includes the operating system, the program that controls the actual computer or central processing unit (CPU), and device drivers that control the input and output devices (I/O) such as printers and terminals.
A number of application programs are usually present waiting to use the CPU. The operating system determines which program will run next, how much of the CPU time it will be allowed to use, and what other computer resources the application will be allowed to access and use. Further, each application program will require a special input or output device and the application program must transfer its data to the operating system, which controls the device drivers.
With the proliferation of graphic chips sets, video subsystems, graphics cards, etc., it has become necessary to write highly device specific code or device drivers to support these hardware subsystems on various operating system platforms. Writing, maintaining, and distributing these device specific software drivers is expensive and problematic. For example, when a complete video device driver is unavailable for a specific super-VGA (SVGA) video adapter, standard VGA virtual video support (VVGA.SYS) is employed. The current VGA virtual video support allows instructions of disk operating system (DOS) or Windows OS/2 (WINOS/2) programs running in the background or in a window on SVGA video adapters to xe2x80x9cbleed throughxe2x80x9d, which means to xe2x80x9cactually affect the real hardwarexe2x80x9d. The current VGA virtual video support also does not correctly draw SVGA video modes in a window.
A VGA device is a video adapter that duplicates all of the video modes of the enhanced graphics adapter (EGA) while adding several more video modes. A WINOS/2 program is a program that runs within a WINOS2 session, which is a session created by the OS/2 operating system, that supports the independent processing of programs that are compatible with Microsoft Windows. The OS/2 operating system is the IBM Operating System/2, available from International Business Machines Corporation. The application in such a situation may adjust registers in the adapter, which control the display of the Presentation Manager desk top. Presentation Manager is the interface of the OS/2 operating system that presents, in windows, a graphics-based interface to applications and files installed and running under the OS/2 operating system. This situation is both undesirable and unexpected by many users. The effects of programs actually affecting the hardware include, for example, a black or otherwise corrupted presentation manager display. In addition, the operating system may hang, at such times as during the initial xe2x80x9cvirtualizedxe2x80x9d video mode set, which happens when a DOS window or a DOS Full Screen Session (FS) is in the background.
Another disadvantage of the VGA virtual video support is its inability to save and restore Super VGA xe2x80x9cVESA standardxe2x80x9d video modes or to correctly draw them in a window. An SVGA adapter is an adapter following a video standard established by VESA to provide high-resolution color display on IBM-Compatible computers. Although SVGA is a standard, compatibility problems often occur within the video BIOS because of differences in design by various manufacturers.
Therefore, it would be advantageous to have an improved method and apparatus for allowing various applications to run in the foreground, background, or in a window and switch back and forth without effecting the appearance of the DOS or WIN OS/2 application or the desk top itself regardless of the video mode or adapter resources used by the application.
The present invention provides a method and apparatus for handling communications between an application and a device through a device driver. Calls or commands are used by the device driver to access the hardware that are common to a number of different types of devices that are to be handled by the device driver. These calls or commands are used to store or save away information in the device when an application accessing the device shifts into a background state from a foreground state. These commands are used to restore information to the device when the application shifts back into the foreground state from the background state. In addition, a range of I/O ports used to access the devices are identified and predicted.
For example, with video adapters, an extended basic adapter type xe2x80x9cGeneric SVGAxe2x80x9d with fixed port addresses beyond the basic adapter type xe2x80x9cVGA standardxe2x80x9d, and additional variable port address ranges identified through PC BIOS calls is described.